package com.easyjava.bean;

import com.easyjava.utils.PropertiesUtils;

public class Constants {

    public static Boolean IGNORE_TABLE_PREFIX; //忽略表前缀
    public static String SUFFIX_BEAN_QUERY;  //搜索参数bean后缀

    //需要忽略的属性
    public static String IGNORE_BEAN_TO_JSON_FIELD;
    public static String IGNORE_BEAN_TO_JSON_EXPRESSION;
    public static String IGNORE_BEAN_TO_JSON_CLASS;
    //日期格式序列化
    public static String BEAN_DATE_FORMAT_EXPRESSION;
    public static String  BEAN_DATE_FORMAT_CLASS;
    //日期格式反序列化
    public static String  BEAN_DATE_UN_FORMAT_EXPRESSION;
    public static String  BEAN_DATE_UN_FORMAT_CLASS;
    public static String PATH_BASE;
    public static String PATH_PO;

    public static String PATH_QUERY;
    public static String PACKAGE_BASE;
    public static String PACKAGE_UTILS;
    public static String PACKAGE_MAPPER;
    public static String PATH_MAPPER;
    public static String PATH_UTILS;
    public static String PACKAGE_PO;
    public static String PATH_JAVA = "java";
    public static String PATH_RESOURCE = "resources";
    public static String DATETIME = "YYYY-MM-dd HH:mm:ss";
    public static String DATE = "YYYY-MM-dd";

    public static String PACKAGE_ENUMS;

    public static String PACKAGE_QUERY;

    public static String PACKAGE_SERVICE;
    public static String PACKAGE_SERVICE_IMPL;
    public static String PACKAGE_VO;

    public static String PATH_ENUMS;


    public static String AUTHER_COMMENT;
    public static String SUFFIX_BEAN_QUERY_FUZZY;
    public static String SUFFIX_BEAN_QUERY_TIME_START;
    public static String SUFFIX_BEAN_QUERY_TIME_END;
    public static String SUFFIX_MAPPER;
    public static String PATH_MAPPER_XML;

    public static String PATH_SERVICE;
    public static String PATH_SERVICE_IMPL;
    public static String PATH_VO;

    public static String PACKAGE_EXCEPTION;

    public static String PATH_EXCEPTION;

    public static String PACKAGE_CONTROLLER;

    public static String PATH_CONTROLLER;
    static {
        IGNORE_TABLE_PREFIX = Boolean.valueOf(PropertiesUtils.getString("ignore.table.prefix"));
        SUFFIX_BEAN_QUERY = PropertiesUtils.getString("suffix.bean.query");

        PACKAGE_BASE = PropertiesUtils.getString("package.base");
        PACKAGE_PO = PACKAGE_BASE + "." + PropertiesUtils.getString("package.po");
        PACKAGE_UTILS = PACKAGE_BASE + "." + PropertiesUtils.getString("package.utils");
        PACKAGE_ENUMS = PACKAGE_BASE + "." + PropertiesUtils.getString("package.enums");
        PACKAGE_SERVICE = PACKAGE_BASE + "." + PropertiesUtils.getString("package.service");
        PACKAGE_SERVICE_IMPL = PACKAGE_BASE + "." + PropertiesUtils.getString("package.service.impl");
        PACKAGE_VO = PACKAGE_BASE + "." + PropertiesUtils.getString("package.vo");
        PACKAGE_MAPPER = PACKAGE_BASE + "." + PropertiesUtils.getString("package.mapper");

        PACKAGE_QUERY = PACKAGE_BASE + "." + PropertiesUtils.getString("package.query");

        PACKAGE_EXCEPTION = PACKAGE_BASE + "." + PropertiesUtils.getString("package.exception");

        PACKAGE_CONTROLLER = PACKAGE_BASE + "." + PropertiesUtils.getString("package.controller");

        PATH_BASE = PropertiesUtils.getString("path.base");
        PATH_BASE = PATH_BASE + PATH_JAVA;

        PATH_PO = PATH_BASE + "/"  + PACKAGE_PO.replace(".","/");
        PATH_UTILS = PATH_BASE + "/"  + PACKAGE_UTILS.replace(".","/");
        PATH_ENUMS = PATH_BASE + "/"  + PACKAGE_ENUMS.replace(".","/");

        PATH_QUERY = PATH_BASE + "/"  + PACKAGE_QUERY.replace(".","/");
        PATH_MAPPER = PATH_BASE + "/"  + PACKAGE_MAPPER.replace(".","/");

        PATH_SERVICE = PATH_BASE + "/"  + PACKAGE_SERVICE.replace(".","/");

        PATH_SERVICE_IMPL = PATH_BASE + "/"  + PACKAGE_SERVICE_IMPL.replace(".","/");

        PATH_EXCEPTION = PATH_BASE + "/"  + PACKAGE_EXCEPTION.replace(".","/");

        PATH_CONTROLLER = PATH_BASE + "/"  + PACKAGE_CONTROLLER.replace(".","/");

        PATH_VO = PATH_BASE + "/"  + PACKAGE_VO.replace(".","/");
        //需要忽略的属性
        IGNORE_BEAN_TO_JSON_FIELD = PropertiesUtils.getString("ignore.bean.toJson.field");
        IGNORE_BEAN_TO_JSON_EXPRESSION = PropertiesUtils.getString("ignore.bean.toJson.expression");
        IGNORE_BEAN_TO_JSON_CLASS = PropertiesUtils.getString("ignore.bean.toJson.class");
        //日期格式序列化
        BEAN_DATE_FORMAT_EXPRESSION = PropertiesUtils.getString("bean.date.format.expression");
        BEAN_DATE_FORMAT_CLASS = PropertiesUtils.getString("bean.date.format.class");
        //日期格式反序列化
        BEAN_DATE_UN_FORMAT_EXPRESSION = PropertiesUtils.getString("bean.date.unFormat.expression");
        BEAN_DATE_UN_FORMAT_CLASS = PropertiesUtils.getString("bean.date.unFormat.class");

        AUTHER_COMMENT = PropertiesUtils.getString("auther.comment");

        SUFFIX_BEAN_QUERY_FUZZY = PropertiesUtils.getString("suffix.bean.query.fuzzy");
        SUFFIX_BEAN_QUERY_TIME_START = PropertiesUtils.getString("suffix.bean.query.time.start");
        SUFFIX_BEAN_QUERY_TIME_END = PropertiesUtils.getString("suffix.bean.query.time.end");
        SUFFIX_MAPPER = PropertiesUtils.getString("suffix.mapper");

        PATH_MAPPER_XML = PropertiesUtils.getString("path.base") + PATH_RESOURCE + "/" + PACKAGE_MAPPER.replace(".","/");
    }

    public static final String[] SQL_DATE_TIME_TYPES = new String[]{"datetime","timestamp"};
    public static final String[] SQL_DATE_TYPES = new String[]{"date"};
    public static final String[] SQL_DECIMAL_TYPES = new String[]{"decimal","double","float"};
    public static final String[] SQL_STRING_TYPES = new String[]{"char","varchar","text","mediumtext","longtext"};
    public static final String[] SQL_INTEGER_TYPES = new String[]{"int","tinyint"};
    public static final String[] SQL_LONG_TYPES = new String[]{"bigint"};

    public static void main(String[] args) {
//        System.out.println(IGNORE_TABLE_PREFIX);
//        System.out.println(SUFFIX_BEAN_PARAM);
        System.out.println(PATH_BASE);
//        System.out.println(PATH_JAVA);
        System.out.println(PATH_PO);
        System.out.println(PACKAGE_UTILS);
        System.out.println(PATH_MAPPER_XML);
    }
}